Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

605
Views
La función "cadenas interpoladas" no está disponible en C# 5. Utilice la versión de idioma 6 o superior.

La siguiente línea no se compila cuando coloco una Razor View.

 var extPropLookupNameCompania = $"extension_{SettingsHelper.ClientId.Replace("-", "")}_{"Compania"}";

Sin embargo, en el controlador, la misma línea funciona perfectamente bien.

¿Por qué no puedo interpolar cadenas de usuario en las vistas de la maquinilla de afeitar? o ¿Tal vez necesito configurar algo?

over 4 years ago · Santiago Trujillo
3 answers
Answer question

0

Si experimenta este error en un proyecto de .NET Framework 4.5.1, la actualización a 4.5.2 resuelve el problema.

over 4 years ago · Santiago Trujillo Report

0

Tienes que encapsularlo con llaves como esta:

EDITAR: actualicé porque faltaba un rizado.

 var extPropLookupNameCompania = $("{extension_{SettingsHelper.ClientId.Replace("-", "")}_{"Compania"}");

Intenté lo siguiente con éxito:

 @($"It is {DateTime.Now}")
over 4 years ago · Santiago Trujillo Report

0

La clave es ver la parte compilerOptions="/langversion:6 de lo siguiente en su web.config. Sin ella, obtuve errores al intentar usar la interpolación de cadenas dentro de un archivo .cshtml.

 <system.codedom> <compilers> <compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:6 /nowarn:1659;1699;1701" /> <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:14 /nowarn:41008 /define:_MYTYPE=\&quot;Web\&quot; /optionInfer+" /> </compilers> </system.codedom>

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!